package com.bbx.taxi.client.Task;

import android.app.Activity;
import android.telephony.TelephonyManager;

import com.bbx.androidapi.util.ToastUtil;
import com.bbx.api.sdk.model.passanger.CodeBuild;
import com.bbx.api.sdk.model.passanger.LoginBuild;
import com.bbx.api.sdk.net.base.BaseNetwork;
import com.bbx.api.sdk.net.passeger.conn.CodeNet;
import com.bbx.api.sdk.net.passeger.conn.LoginNet;
import com.bbx.taxi.client.Bean.Message.ObserverListener;

/**
 * 作者：严旭文 on 2016/12/29 10:47
 * 邮箱：420255048@qq.com
 */
public class MyLoginTask extends BaseTask{
    public ObserverListener.DATA_TYPE TYPE= ObserverListener.DATA_TYPE.LOGIN;
    private LoginBuild mLoginBuild;
    public MyLoginTask(Activity context,String phone,String code,String recommend_code) {
        super(context);
        mLoginBuild = new LoginBuild(context);
        mLoginBuild.phone = phone;
        mLoginBuild.code =code;
        mLoginBuild.recommend_code=recommend_code;
        try {
            mLoginBuild.imei = ((TelephonyManager)context. getSystemService(context.TELEPHONY_SERVICE))
                    .getDeviceId();
        }catch (Exception e){
            mLoginBuild.imei = "google";
        }
    }
    @Override
    public boolean isShow() {
        return true;
    }

    @Override
    public boolean isReturnString() {
        return false;
    }
    @Override
    public boolean condition() {
        // TODO Auto-generated method stub
        return true;
    }
    @Override
    public void request() {
        setType(TYPE,mLoginBuild);
    }
    @Override
    public void success(int status,Object object) {
        // TODO Auto-generated method stub

    }
    @Override
    public void failed(int status, String msg,String message) {
        ToastUtil.showToast(context, message);
    }
    @Override
    public BaseNetwork getBaseNetwork() {
        return new LoginNet(context);
    }
}
